package AccionBoton;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;

public class AccionActivarPanelBarrido implements ActionListener{

	
	private JPanel _panel;
	private boolean _accion;
	public AccionActivarPanelBarrido(JPanel panel,boolean accion){
		
		
		_panel =panel;
		_accion = accion;
	}
	
	public void actionPerformed(ActionEvent evt){
		
		for(int i =0; i<_panel.getComponentCount();i++){
			if(_panel.getComponent(i).getClass().equals(new JPanel().getClass())){
				
				for(int j=0; j<((JPanel)_panel.getComponent(i)).getComponentCount();j++){
					
					((JPanel)_panel.getComponent(i)).getComponent(j).setEnabled(_accion);
					
				}
				
				
			}
			_panel.getComponent(i).setEnabled(true);
			
		}
		
	}
	
	
	
	
}
